package com.smartlink.app.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.PagerTabStrip;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.smartlink.app.R;
import com.smartlink.app.adapter.ViewPageAdapter;

import java.util.ArrayList;
import java.util.List;


public class ClassRoomFragment extends Fragment {

    private ViewPager viewPager;
    private ViewPageAdapter adapter;
    private PagerTabStrip pts_class_room_tab;

    public ClassRoomFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_class_room, container, false);
        bindView(view);
        return view;
    }


    private void bindView(View rootView) {
        viewPager = (ViewPager) rootView.findViewById(R.id.vp_class_room_content);
        pts_class_room_tab = (PagerTabStrip) rootView.findViewById(R.id.pts_class_room_tab);

        //初始化ViewPage、
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(new OutDoorFragment());
        fragments.add(new InDoorFragment());
        adapter = new ViewPageAdapter(getChildFragmentManager(), fragments);
        viewPager.setCurrentItem(0);
        viewPager.setAdapter(adapter);
    }


}
